package pro.shushi.pamirs.hr.core.session;

import pro.shushi.pamirs.business.api.model.PamirsEmployee;
import pro.shushi.pamirs.meta.api.CommonApiFactory;
import pro.shushi.pamirs.meta.api.session.PamirsSession;
import pro.shushi.pamirs.user.api.model.PamirsUser;

public class HrSimpleSession extends PamirsSession {

    public static PamirsUser getUser() {
        return CommonApiFactory.getApi(HrSimpleSessionApi.class).getUser();
    }

    public static PamirsEmployee getEmployee() {
        return CommonApiFactory.getApi(HrSimpleSessionApi.class).getEmployee();
    }

    public static String getEmployeeName() {
        PamirsEmployee employee = getEmployee();
        if (employee !=null) {
            return employee.getName();
        }

        return PamirsSession.getUserName();
    }

}